package com.nut.lmsc.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.nut.lmsc.common.BaseEntity;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 店铺表
 */
@Data
@TableName("biz_shop")
public class Shop extends BaseEntity {

    private Integer id;

    //会员Id
    private Long memberId;

    //手机号
    private String mobile;

    //会员名称
    private String memberName;

    //店铺名称
    private String name;

    //店铺logo
    private String logo;

    //一级类目ID
    private Integer catId;

    //一级类目
    private String cat;

    //省市区 逗号分隔
    private String pathName;

    //省市区id 逗号分隔
    private String pathId;

    //地址
    private String address;

    //店铺简介
    private String brief;

    //营业时间
    private String businessTimes;

    //经度
    private BigDecimal lon;

    //纬度
    private BigDecimal lat;

    //距离
    @TableField(exist = false)
    private Integer distance;

    //结算账户ID
    private String settleAccountId;

    //状态 0初始状态 1待审核 2审核不通过 3审核通过 4暂停营业 5营业中 6已禁用
    private Integer status;

    //是否自营 1是 0否
    private Integer own;

    //店铺性质 1实物 2服务
    private Integer nature;

    //是否已缴纳保证金 1是 0否
    private Integer guarantee;

    //是否有创建生态圈权限 1是 0否
    private Integer circle;

    //圈ID
    private Integer circleId;

    //圈名
    private String circleName;

    //提交时间
    private String submitTime;

    //审核时间
    private String checkTime;

    //入驻时间
    private String enterTime;

    //店铺关闭时间
    private String endTime;

    //原因
    private String reason;

    //物流评分
    private Integer deliveryScore;

    //描述评分
    private Integer descScore;

    //服务评分
    private Integer serviceScore;

    //商品数量
    private Integer goodsNum;

    //收藏数量
    private Integer starNum;

    //公司名称
    @TableField(exist = false)
    private String companyName;

    //公司所在地 填省市名称
    @TableField(exist = false)
    private String companyPath;

    //公司所在地 填省市编码
    @TableField(exist = false)
    private String companyPathNo;

    //公司详细地址
    @TableField(exist = false)
    private String companyAddress;

    //注册资金
    @TableField(exist = false)
    private String registerMoney;

    //联系人姓名
    @TableField(exist = false)
    private String linkName;

    //联系人电话
    @TableField(exist = false)
    private String linkPhone;

    //公司邮箱
    @TableField(exist = false)
    private String companyMail;

    //营业执照号
    @TableField(exist = false)
    private String licenceNum;

    //法人身份证截止时间
    @TableField(exist = false)
    private String licenceEndDate;

    //法定经营范围
    @TableField(exist = false)
    private String licenceScope;

    //营业执照
    @TableField(exist = false)
    private String licenceImg;

    //法人姓名
    @TableField(exist = false)
    private String legalName;

    //法人身份证号
    @TableField(exist = false)
    private String legalIdent;

    //法人身份证截止时间 长期传2099-12-31
    @TableField(exist = false)
    private String legalEndTime;

    //法人手机号
    @TableField(exist = false)
    private String legalMobile;

    //法人身份证照片正面
    @TableField(exist = false)
    private String legalIdentFront;

    //法人身份证照片背面
    @TableField(exist = false)
    private String legalIdentBack;

    //银行开户名
    @TableField(exist = false)
    private String bankAccountName;

    //银行账号
    @TableField(exist = false)
    private String bankAccountNum;

    //银行名称
    @TableField(exist = false)
    private String bankName;

    //银行编码
    @TableField(exist = false)
    private String bankNo;

    //支行名称
    @TableField(exist = false)
    private String bankBranchName;

    //支行联行号
    @TableField(exist = false)
    private String bankBranchNum;

    //银行开户证明
    @TableField(exist = false)
    private String bankOpen;

    //结算周期
    @TableField(exist = false)
    private String settlementCycle;

    //店铺上次结算日
    @TableField(exist = false)
    private String settlementDay;

    //备注
    @TableField(exist = false)
    private String remark;

    //上级手机号
    @TableField(exist = false)
    private String upperMobile;

    public ShopDetail getShopDetail() {
        ShopDetail detail = new ShopDetail();
        detail.setId(this.id);
        detail.setCompanyName(this.companyName);
        detail.setCompanyPath(this.companyPath);
        detail.setCompanyPathNo(this.companyPathNo);
        detail.setCompanyAddress(this.companyAddress);
        detail.setRegisterMoney(this.registerMoney);
        detail.setLinkName(this.linkName);
        detail.setLinkPhone(this.linkPhone);
        detail.setCompanyMail(this.companyMail);
        detail.setLicenceNum(this.licenceNum);
        detail.setLicenceEndDate(this.licenceEndDate);
        detail.setLicenceScope(this.licenceScope);
        detail.setLicenceImg(this.licenceImg);
        detail.setLegalName(this.legalName);
        detail.setLegalIdent(this.legalIdent);
        detail.setLegalEndTime(this.legalEndTime);
        detail.setLegalMobile(this.legalMobile);
        detail.setLegalIdentFront(this.legalIdentFront);
        detail.setLegalIdentBack(this.legalIdentBack);
        detail.setBankName(this.bankName);
        detail.setBankAccountName(this.bankAccountName);
        detail.setBankAccountNum(this.bankAccountNum);
        detail.setBankBranchName(this.bankBranchName);
        detail.setBankBranchNum(this.bankBranchNum);
        detail.setBankOpen(this.bankOpen);
        detail.setSettlementDay(this.settlementDay);
        detail.setSettlementCycle(this.settlementCycle);
        detail.setRemark(this.remark);
        detail.setBankNo(this.bankNo);
        return detail;
    }

    public boolean needUpdateDetail() {
        return this.companyName != null ||
                this.companyPath != null ||
                this.companyAddress != null ||
                this.registerMoney != null ||
                this.linkName != null ||
                this.linkPhone != null ||
                this.companyMail != null ||
                this.licenceNum != null ||
                this.licenceEndDate != null ||
                this.licenceScope != null ||
                this.licenceImg != null ||
                this.legalName != null ||
                this.legalIdent != null ||
                this.legalEndTime != null ||
                this.legalMobile != null ||
                this.legalIdentBack != null ||
                this.legalIdentFront != null ||
                this.bankName != null ||
                this.bankNo != null ||
                this.bankAccountName != null ||
                this.bankAccountNum != null ||
                this.bankBranchName != null ||
                this.bankOpen != null ||
                this.settlementCycle != null ||
                this.remark != null;
    }

    public boolean needUpdate() {
        return this.mobile != null ||
                this.memberName != null ||
                this.name != null ||
                this.logo != null ||
                this.cat != null ||
                this.pathName != null ||
                this.pathId != null ||
                this.address != null ||
                this.businessTimes != null ||
                this.lon != null ||
                this.lat != null ||
                this.status != null ||
                this.own != null ||
                this.nature != null ||
                this.guarantee != null ||
                this.brief != null;
    }

}
